// Copyright 2006 PR1ME. All Rights Reserved.
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class FileInfo {
  public FileInfo(String filePath) {
    this.filePath = filePath;
  }

  public void add(String word) {
    Integer count = (Integer) wordMap.get(word);
    if (count == null) {
      count = new Integer(1);
    } else {
      count = new Integer(count.intValue() + 1);
    }
    wordMap.put(word, count);
  }

  public void countWord() {
    ++words;
  }
  public void createBitSet(ArrayList wordList) {
    int size = wordList.size();
    bitSet  = new MyBitSet(size);
    for (int i = 0; i < size; ++i) {
      bitSet.set(i, wordMap.containsKey(wordList.get(i)));
    }
  }

  public BitSet getBitSet() {
    return bitSet;
  }

  public int getCharacters() {
    return characters;
  }

  public String getFilePath() {
    return filePath;
  }

  public int getWords() {
    return words;
  }

  public Set getWordSet() {
    return wordMap.keySet();
  }

  public void setCharacters(int characters) {
    this.characters = characters;
  }

  public void setWords(int words) {
    this.words = words;
  }

  private MyBitSet bitSet;
  private int characters;
  private final String filePath;
  private final Map wordMap = new HashMap();
  private int words;
}
